package com.baomidou.dynamic.datasource;

import com.baomidou.dynamic.datasource.config.JdbcDynamicDataSourceProvider;
import com.baomidou.dynamic.datasource.provider.DynamicDataSourceProvider;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@SpringBootApplication
@EnableTransactionManagement
public class DynamicDataSourceApplication {

    public static void main(String[] args) {
        SpringApplication.run(DynamicDataSourceApplication.class, args);
    }

    @Bean
//    @Primary
    public DynamicDataSourceProvider dataSourceProvider(){
        return new JdbcDynamicDataSourceProvider();
    }

}
